package com.xingzuo.library_user.ui;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.xingzuo.base.app.AppActivityKey;
import com.xingzuo.base.ui.mvp.base.ui.BaseMvpActivity;
import com.xingzuo.common.view.calendarview.utils.CalendarUtil;
import com.xingzuo.common.view.calendarview.weiget.CalendarView;
import com.xingzuo.library_user.R;
import com.xingzuo.library_user.R2;
import com.xingzuo.library_user.adapter.AppontThingAdapter;
import com.xingzuo.library_user.bean.AppointThingBean;
import com.xingzuo.library_user.contract.AppointmentContract;
import com.xingzuo.library_user.presenter.AppointmentPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

@Route(path = AppActivityKey.APPOINTMENTACTIVITY)
public class AppointmentActivity extends BaseMvpActivity<AppointmentPresenter> implements AppointmentContract.View {
    @BindView(R2.id.calendar)
    CalendarView calendar;
    @BindView(R2.id.rv_back)
    ImageView rvBack;
    @BindView(R2.id.rv_list)
    RecyclerView rvList;
    private int[] cDate = CalendarUtil.getCurrentDate();
    private AppontThingAdapter appontThingAdapter;
    private List<AppointThingBean> list=new ArrayList<>();
    @Override
    public AppointmentPresenter getPresenter() {
        return new AppointmentPresenter();
    }

    @Override
    public int getView() {
        return R.layout.activity_appointment;
    }

    @Override
    public void initView() {
        calendar
//                .setSpecifyMap(map)
                .setStartEndDate("2016.1", "2028.12")
                .setDisableStartEndDate("2016.10.10", "2028.10.10")
                .setInitDate(cDate[0] + "." + cDate[1])
                .setSingleDate(cDate[0] + "." + cDate[1] + "." + cDate[2])
                .init();
        rvList.setLayoutManager(new LinearLayoutManager(this));
        appontThingAdapter=new AppontThingAdapter(R.layout.item_appoint_list,list);
        rvList.setAdapter(appontThingAdapter);
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        list.add(new AppointThingBean());
        list.add(new AppointThingBean());
        list.add(new AppointThingBean());
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R2.id.rv_back)
    public void onViewClicked() {
        finishActivity();
    }
}